/** layuiAdmin.std-v1.0.0-beta7 LPPL License By http://www.layui.com/admin/ */
;layui.define(["form",'http', "upload"], function (t) {
    var $ = layui.$
        , layer = layui.layer
        , http = layui.http
        , a = (layui.laytpl, layui.setter, layui.view, layui.admin)
        , form = layui.form;
    $("body");
    form.verify({
        realName: function (t, i) {
            return new RegExp("^[a-zA-Z0-9_一-龥\\s·]+$").test(t) ? /(^\_)|(\__)|(\_+$)/.test(t) ? "用户名首尾不能出现下划线'_'" : /^\d+\d+\d$/.test(t) ? "用户名不能全为数字" : void 0 : "用户名不能有特殊字符"
        }, pass: [/^[\S]{6,12}$/, "密码必须6到12位，且不能出现空格"], repass: function (t) {
            if (t !== $("#LAY_password").val()) return "两次密码输入不一致"
        }
    });
    form.on("submit(setmypass)", function (data) {
        var _that = $(this);
        _that.text("修改中...").attr("disabled", "disabled").addClass("layui-disabled");
        http.post({
                loading: true,
                loadingText: '修改中，请稍候...',
                url: "/core/user/modifyPwd",
                data: data.field,
                success: function (res) {
                    //登入成功的提示与跳转
                    layer.msg('修改成功', {
                        offset: '15px'
                        , icon: 1
                        , time: 1000
                    }, function () {
                        location.href = "/login";
                    });
                },
                error: function () {
                    _that.text("确认修改").removeAttr("disabled").removeClass("layui-disabled");
                }
            }
        );
        return false;
    }), t("set", {})
});